Skip to content

Add configurable SMT pad pair footprint - #751

Open
seveibar wants to merge 2 commits into
mainfrom
codex/smtpadpair
Open

Add configurable SMT pad pair footprint#751
seveibar wants to merge 2 commits into
mainfrom
codex/smtpadpair

Conversation

@seveibar

@seveibar seveibar commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add an smtpadpair primitive with signed x/y pad offset and independent pin 1/pin 2 dimensions
  • support compact shared pw/ph dimensions when both pads match
  • add an outward pin-1 arrow and place reference text on the opposite side
  • parse numbered pad parameters such as p1w and p2h in Footprinter strings
  • cover asymmetric and staggered layouts with SVG snapshots

Benchmark impact

The corresponding circuit-json-to-footprinter matcher improves the jlc5000 95% IoU benchmark from 471/600 (78.50%) to 483/600 (80.50%), recovering all 12 rectangular two-pad misses.

Testing

  • bun test tests/smtpadpair.test.ts
  • bun run build

@seveibar
seveibar requested a review from techmannih as a code owner July 28, 2026 22:47
Comment thread tests/smtpadpair.test.ts
Comment on lines +18 to +50
test("smtpadpair supports independently sized pads", () => {
const footprint = "smtpadpair_px2.1mm_ph1mm_p1w2mm_p2w1.2mm"
const circuitJson = fp.string(footprint).circuitJson()

expect(getPadGeometry(footprint)).toEqual([
{ x: -1.05, y: 0, width: 2, height: 1, port_hints: ["1"] },
{ x: 1.05, y: 0, width: 1.2, height: 1, port_hints: ["2"] },
])
expect(convertCircuitJsonToPcbSvg(circuitJson)).toMatchSvgSnapshot(
import.meta.path,
"asymmetric",
)
})

test("smtpadpair supports a signed vertical pad offset", () => {
const footprint = "smtpadpair_px13.45mm_py-2.54mm_pw2.5mm_ph2.55mm"
const circuitJson = fp.string(footprint).circuitJson()

expect(getPadGeometry(footprint)).toEqual([
{ x: -6.725, y: 1.27, width: 2.5, height: 2.55, port_hints: ["1"] },
{ x: 6.725, y: -1.27, width: 2.5, height: 2.55, port_hints: ["2"] },
])
expect(convertCircuitJsonToPcbSvg(circuitJson)).toMatchSvgSnapshot(
import.meta.path,
"staggered",
)
})

test("smtpadpair rejects coincident pads", () => {
expect(() => fp.string("smtpadpair_px0mm_py0mm").circuitJson()).toThrow(
"non-zero center offset",
)
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file contains three test(...) calls (at lines 18, 32, and 46), but the rule states that a *.test.ts file may have AT MOST one test(...). The additional tests should be split into separate, numbered files — for example: smtpadpair1.test.ts, smtpadpair2.test.ts, and smtpadpair3.test.ts.

Spotted by Graphite (based on custom rule: Custom rule)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant